//
//  LYVideoButtonView.m
//  LYLiveApp
//
//  Created by QD on 16/8/30.
//  Copyright © 2016年 览益信息科技. All rights reserved.
//

#import "LYVideoButtonView.h"
#import "LYIntroduceModel.h"
#import "LYHTTPSessionManager.h"
#import "LYUtil.h"
#import "UMMobClick/MobClick.h"

//static const NSTimeInterval     kDelayInSeconds          = 30.0f;

@interface LYVideoButtonView ()
@property (weak, nonatomic) IBOutlet UIButton *timeBtn;
@property (weak, nonatomic) IBOutlet UIButton *commentBtn;
@property (weak, nonatomic) IBOutlet UIButton *teacherBtn;
@property (weak, nonatomic) IBOutlet UIView *rightLine;
@property (weak, nonatomic) IBOutlet UIView *leftLine;
@property (weak, nonatomic) IBOutlet UIView *midLine;

@end

@implementation LYVideoButtonView

- (void)setButtonType:(ButtonViewType)buttonType {
    _buttonType = buttonType;
    switch (buttonType) {
        case IntroduceButtonSelected:
            self.timeBtn.selected       = YES;
            self.commentBtn.selected    = NO;
            self.teacherBtn.selected    = NO;
            self.midLine.hidden         = NO;
            self.leftLine.hidden        = YES;
            self.rightLine.hidden       = YES;
            break;
        case CommentButtonSelected:
            self.timeBtn.selected       = NO;
            self.teacherBtn.selected    = NO;
            self.commentBtn.selected    = YES;
            self.midLine.hidden         = YES;
            self.rightLine.hidden       = NO;
            self.leftLine.hidden        = YES;
            break;
        case LikeButtonSelected:
            break;
        case VideoFinished:
            break;
        case TeacherButtonSelected:
            self.timeBtn.selected       = NO;
            self.teacherBtn.selected    = YES;
            self.commentBtn.selected    = NO;
            self.midLine.hidden         = YES;
            self.rightLine.hidden       = YES;
            self.leftLine.hidden        = NO;

            break;
   
        default:
            break;
    }
}

#pragma mark ----- event response
- (IBAction)teacherAction:(id)sender {
    
    if (self.teacherBlock) {
        self.teacherBlock();
    }

}


- (IBAction)shareAction:(id)sender {
    
    if (self.shareBlock) {
        self.shareBlock();
    }
}
#pragma mark - ******** 点击时刻表 快捷键为mark
- (IBAction)introduceAction:(id)sender {
    if (self.introduceBlock) {
        [MobClick event:@"videoLive_introduce"];

        self.introduceBlock();
    }
}
#pragma mark - ******** 点击互动 快捷键为mark
- (IBAction)commentAction:(id)sender {
    if (self.commentBlock) {
        [MobClick event:@"videoLive_comment"];

        self.commentBlock();
    }
}

- (void)setModel:(LYIntroduceModel *)model {

    _model = model;
    if (!model.bigCardName.length) {
        model.bigCardName = @"高手帮";
    }
    [self.teacherBtn setTitle:model.bigCardName forState:UIControlStateNormal];
}

+ (instancetype)viewWithXib
{
    LYVideoButtonView *view = [[[UINib nibWithNibName:@"LYVideoButtonView" bundle:nil] instantiateWithOwner:self options:nil] lastObject];
    return view;
}

@end
